package com.ytrsoft.ws;


import javax.websocket.CloseReason.CloseCodes;

public abstract class OnceSocketService<T extends BaseSocket> extends AbstractSocketService<T> {
    @Override
    protected void handleOpen(T socket) {
        int count = connectionCount.get();
        if (count >= 1) {
            socket.close(CloseCodes.TRY_AGAIN_LATER, "请稍后再试");
        } else {
            super.handleOpen(socket);
        }
    }
}
